<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head> 
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
	<title>湖南省自来水公司营销管理信息系统</title> 
	
	<link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/text.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/form.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/buttons.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/grid.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/layout.css" type="text/css" media="screen" title="no title" />
	
	<link rel="stylesheet" href="../../../css/ui-darkness/jquery-ui-1.8.12.custom.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/plugin/jquery.visualize.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/plugin/facebox.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/plugin/uniform.default.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../../../css/plugin/dataTables.css" type="text/css" media="screen" title="no title" />
	
	<link rel="stylesheet" href="../../../css/custom.css" type="text/css" media="screen" title="no title">

</head> 
 
<body> 

<div id="wrapper">
<#include "../common/header.ftl"/>
	
	<div id="content" class="xgrid">
		
 		
		<div class="x12">
			
			<h2>
				用户申请 - 办理银行代扣水费业务
				<a style="float:right" href="javascript:history.back(-1);">返回</a>
			</h2>
			
			<div class="tab_container">
				<ul class="tabs"> 
					<li><a href="#tab1">申请表</a></li> 
					<li><a href="#tab2">代扣用户</a></li>
				</ul> 
				<div class="tab_content_container"> 
					<div id="tab1" class="tab_content">
						<table width="100%">
							<thead>
								<tr>
									<th width="60"></th>
									<th width="220"></th>
									<th width="60"></th>
									<th></th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>用户名称</td>
									<td><input id="username"/></td>
									<td>收费方式</td>
									<td><select style="width:158px;" id="paytype">
											<option>坐收</option>
											<option>走收</option>
											<option selected="selected">银行代扣</option>
										</select>
									</td>
								</tr>
								<tr>
									<td>开户银行</td>
									<td><input id="bankcompany"/></td>
									<td>银行账号</td>
									<td><input id="banknum"/></td>
								</tr>
								<tr>
									<td>备注说明</td>
									<td colspan="3"><input size="68" id="userremark"/></td>
								</tr>
							</tbody>
							</table>
					</div>
					<div id="tab2" class="tab_content">
						<div class="form label-inline uniform">


                            <div class="field">原用户编码<input id="olduserno"/> <button class="btn btn-small" id="inui">确定</button><span id="cou"></span></div>
                            <div class="field">原用户姓名<input disabled="disabled"  id="oldusername" /></div>
                            <div class="field">原用户电话<input disabled="disabled" id="phone1"/></div>
                            <div class="field">原用户表径<input disabled="disabled" id="oldmeter"/></div>
                            <div class="field">原用户地址<input disabled="disabled" size="50" id="address1"/></div>

                            <div class="centerButtons">
                                <button class="btn" id="go">办理</button>
                                <input type="hidden" id="createemp" value="${user.id}">
                                <button class="btn btn-grey" onClick="history.back(-1);">返回</button>
                            </div>

						</div>
					</div>
					
				</div>
			</div>
	
	
			
		</div> <!-- .x12 -->
		

		
	</div> <!-- #content -->
	
	<div id="footer">		
		<div class="content_pad">			
			<p>&copy; 2013-11 版权所有 <a href="#">湖南省自来水公司</a>.   技术支持 <a href="#">华瑞教育</a>.</p>
		</div> <!-- .content_pad -->
	</div> <!-- #footer -->
	
</div> <!-- #wrapper -->

<script src="../../../js/jquery/jquery-1.5.2.min.js"></script>
<script src="../../../js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="../../../js/misc/excanvas.min.js"></script>
<script src="../../../js/jquery/facebox.js"></script>
<script src="../../../js/jquery/jquery.visualize.js"></script>
<script src="../../../js/jquery/jquery.dataTables.min.js"></script>
<script src="../../../js/jquery/jquery.tablesorter.min.js"></script>
<script src="../../../js/jquery/jquery.uniform.min.js"></script>
<script src="../../../js/jquery/jquery.placeholder.min.js"></script>

<script src="../../../js/widgets.js"></script>
<script src="../../../js/dashboard.js"></script>

<script type="text/javascript">
	
$(document).ready ( function () 
{
	Dashboard.init ();	
	
	//选项卡初始化
	$('.tab_container').tabs ();	
});

$(function () {
    $("#inui").click(function () {
        $.ajax({
            url:"/usUser/getlookuser",    //请求的url地址
            dataType:"json",   //返回格式为json
            async:true,//请求是否异步，默认为异步，这也是ajax重要特性
            data:{
                "olduserno":$("#olduserno").val(),
            },
            type:"POST",   //请求方式
            success:function(req){
                //请求成功时处理
                if (req==null) {
                    var f = "<span style='color: red'>查找不到该用户</span>";
                    $("#cou").html(f);
                    $("#oldusername").val("")
                    $("#phone1").val("")
                    $("#oldmeter").val("")
                    $("#address1").val("")
                }else if (req.disabled==1) {
                    var d = "<span style='color: red'>用户被禁用</span>";
                    $("#cou").html(d);
                }else {
                    $("#oldusername").val(req.UserName)
                    $("#phone1").val(req.Phone)
                    $("#oldmeter").val(req.MeterTypeName)
                    $("#address1").val(req.Address)
                    $("#cou").html(" ");
                }

            },

        });
    })




    // 添加换表用户
    $("#go").click(function () {
        var uname = $("#username").val()//用户姓名
        var pay = $("#paytype").val()//收费方式
        var company = $("#bankcompany").val()//开户银行
        var num = $("#banknum").val()//银行账号
        var mark = $("#userremark").val()//备注说明
		if(uname==""){
            alert("用户姓名不能为空！")
            return false
        }
        if(company==""){
            alert("开户银行不能为空！")
            return false
        }
        if(num==""){
            alert("银行账户不能为空！")
            return false
        }
        if(mark==""){
            alert("备注说明不能为空！")
            return false
        }
        if($("#olduserno").val()==""){
            alert("原用户编码不能为空")
            return false
        }
        if($("#oldusername").val()==""){
            alert("原用户信息不能为空")
            return false
        }



        $.ajax({
            url:"/beOrder/addlookuser",    //请求的url地址
            dataType:"json",   //返回格式为json
            async:true,//请求是否异步，默认为异步，这也是ajax重要特性
            data:{
                "username":uname,
                "paytype":pay,
                "bankcompany":company,
                "banknum":num,
                "userremark":mark,
                "ordertype":4,//申请类型
                "olduserno":$("#olduserno").val(),
                "oldusername":$("#oldusername").val(),
                "oldmeter":$("#oldmeter").val()
                "createemp":$("#createemp").val(),
            },
            type:"post", //请求方式
            success:function(succ){
                $("#tab_container").find("input").each(function(){
                    this.value ="";
                });
                window.location.href="http://localhost:8090/suces?pagename=request1";
            }
        });

    })

})


</script>

</body> 
 
</html>